package com.resou.reader.bookstore;

import android.content.Context;
import android.graphics.Outline;
import android.graphics.Rect;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;
import com.resou.reader.R;
import com.resou.reader.api.entry.CarousePicBean;
import com.resou.reader.api.entry.CommonData;
import com.resou.reader.assist.WebActivity;
import com.resou.reader.bookdetail.BookDetailActivity;
import com.resou.reader.bookstore.category.AllCategoryActivity;
import com.resou.reader.bookstore.freeandfinish.FinishBookActivity;
import com.resou.reader.bookstore.freezone.FreezoneActivity;
import com.resou.reader.bookstore.rank.RankMainActivity;
import com.resou.reader.data.bookstore.model.BasicList;
import com.resou.reader.data.bookstore.model.PlateNovels;
import com.resou.reader.mine.vipcenter.MonthlyVipActivity;
import com.resou.reader.utils.NetworkUtils;
import com.resou.reader.utils.ToastUtil;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BookStoreMainAdapter extends RecyclerView.Adapter {
    private static final String TAG = "BookStoreMainAdapter";


    private Context mContext;
    private List<Object> mObjects;
    private BookStoreAdapter mAdapter;

    public BookStoreMainAdapter(Context context) {
        this.mContext = context;
        mObjects = new ArrayList<>();
        mObjects.add("banner");
        mObjects.add(null);
    }

    private OnStoreMainAdapterInteractionListener mInteractionListener;

    public void setInteractionListener(OnStoreMainAdapterInteractionListener interactionListener) {
        mInteractionListener = interactionListener;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
        if (viewType == TYPE_BANNER) {
            return new BannerViewHolder(LayoutInflater.from(mContext).inflate(R.layout.book_store_banner_layout, viewGroup, false));
        }
        if (viewType == TYPE_ENTRANCE) {
            return new EntranceHolder(LayoutInflater.from(mContext).inflate(R.layout.book_store_entrance_layout, viewGroup, false));
        }
        if (viewType == TYPE_EDITOR_RECOMMEND) {
            //小编推荐 书友在读 往期经典
            return new TypeEditorRecommendHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_editor_recommend, viewGroup, false));
        }
        if (viewType == TYPE_FOR_FREE) {
            //限时免费
            TimeForFreeHolder holder = new TimeForFreeHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_for_free, viewGroup, false));
            final LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
            layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
            holder.recyclerView.setLayoutManager(layoutManager);
            holder.recyclerView.setHasFixedSize(true);
            mAdapter = new BookStoreAdapter(mContext, TYPE_FOR_FREE);
            holder.recyclerView.setAdapter(mAdapter);
            holder.recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
                @Override
                public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
                    if (parent.getChildAdapterPosition(view) == mAdapter.getItemCount() - 1) {
                        return;
                    }
                    outRect.right = 20;
                }
            });
            return holder;
        }
        if (viewType == TYPE_VIP_ZONE) {
            //VIP专区
            return new VIPHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_vip_zone, viewGroup, false));
        }
        if (viewType == TYPE_HOT_SEARCH) {
            //热搜榜 兴趣选书
            return new TypeFineHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_hot_serial, viewGroup, false));
        }
        if (viewType == TYPE_HOT_SERIAL) {
            //火热连载
            return new TypeFineHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_hot_serial, viewGroup, false));
        }
        if (viewType == TYPE_HIGH_FORCE_RECOMMEND) {
            //口碑力荐 极品爽文
            return new TypeFineHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_hot_serial, viewGroup, false));
        }
        if (viewType == TYPE_FINE) {
            //精品推荐 畅销新书
            return new TypeFineHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_hot_serial, viewGroup, false));
        }
        if (viewType == TYPE_FINISH) {
            //奇文精品 完结榜
            return new TypeFineHolder(LayoutInflater.from(mContext).inflate(R.layout.recycler_item_type_hot_serial, viewGroup, false));
        }
        return new DefaultHolder(LayoutInflater.from(mContext).inflate(R.layout.empty_layout, viewGroup, false));
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {

        Object o = mObjects.get(position);
        if (o instanceof CommonData) {
            CommonData<List<CarousePicBean>> banner2 = (CommonData<List<CarousePicBean>>) o;
            if (viewHolder instanceof BannerViewHolder) {
                BannerViewHolder banner = (BannerViewHolder) viewHolder;
                List<CarousePicBean> banners = banner2.getData();
                if (banners.size() == 0) {
                    viewHolder.itemView.setVisibility(View.GONE);
                    return;
                }
                banner.mBanner.setImages(banners);
                banner.mBanner.setOnBannerListener(position1 -> {
                    int type = banners.get(position1).getType();
                    CarousePicBean picBean = banners.get(position1);
                    if (type == 1) {
                        BookDetailActivity.startDetailActivity(mContext, banners.get(position1).getContent());
                    }
                    if (type == 2) {
                        WebActivity.startActivity(mContext, picBean.getContent(), picBean.getNovelName());
                    }
                    if (type == 3) {
                        MonthlyVipActivity.start(mContext);
                    }
                });
                banner.mBanner.start();
            }
        }
        if (o == null) {
            if (viewHolder instanceof EntranceHolder) {
                EntranceHolder entranceHolder = (EntranceHolder) viewHolder;
                entranceHolder.llCategory.setOnClickListener(v -> AllCategoryActivity.startActivity(mContext));
                entranceHolder.llRankList.setOnClickListener(v -> RankMainActivity.startActivity(mContext));
                entranceHolder.ll_monthly.setOnClickListener(v -> MonthlyVipActivity.start(mContext));
                entranceHolder.ll_FreeOnclick.setOnClickListener(v -> FreezoneActivity.start(mContext));
                entranceHolder.llFinish.setOnClickListener(v -> FinishBookActivity.startActivity(mContext, "0"));
            }
        }
        if (o instanceof BasicList) {
            BasicList<PlateNovels> basicList = (BasicList<PlateNovels>) o;
//            Log.e(TAG, basicList.getPlateName()+" holder.tvSeeMore viewType = " + basicList.getViewType());
            List<PlateNovels> novels = basicList.getPlateNovels();
            int viewType = getItemViewType(position);
            //限时免费
            if (viewType == TYPE_FOR_FREE) {
                TimeForFreeHolder holder = (TimeForFreeHolder) viewHolder;
                holder.tvTitle.setText(basicList.getPlateName());
                mAdapter.setData(novels);
            }
            if (viewType == TYPE_EDITOR_RECOMMEND) {
                //编辑推荐
                if (viewHolder instanceof TypeEditorRecommendHolder) {
                    TypeEditorRecommendHolder holder = (TypeEditorRecommendHolder) viewHolder;
                    holder.tvTitle.setText(basicList.getPlateName());
                    if (basicList.getPlateName().equals("小编推荐")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_recm);
                    } else if (basicList.getPlateName().equals("免费精品")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_free_best);
                    } else if (basicList.getPlateName().equals("书友在读")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_reader);
                    } else if (basicList.getPlateName().equals("往期经典")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_reader);
                    }

                    if (basicList.getViewType() == 0) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                    }
                    if (basicList.getPlateType().equals("55")) {
                        holder.tvSeeMore.setText("免费专区>");
                    }
                    if (basicList.getPlateName().equals("往期经典")) {
                        holder.tvSeeMore.setVisibility(View.VISIBLE);
                        holder.tvTitle.setText(basicList.getPlateName());
                        holder.tvSeeMore.setText("换一换");
                    }
//                    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
//                    layoutManager.setOrientationentation(LinearLayoutManager.HORIZONTAL);
                    GridLayoutManager layoutManager = new GridLayoutManager(mContext, 4);
                    holder.recyclerView.setLayoutManager(layoutManager);
                    holder.recyclerView.setHasFixedSize(true);
                    BookStoreAdapter recommendAdapter = new BookStoreAdapter(mContext, TYPE_EDITOR_RECOMMEND);
                    holder.recyclerView.setAdapter(recommendAdapter);
                    recommendAdapter.setData(novels, basicList.getPlateType());
                    holder.tvSeeMore.setOnClickListener(v -> {
                        if (NetworkUtils.isNetworkConnected(mContext)) {
                            mInteractionListener.onMoreClicked(basicList.getPlateName(), basicList.getPlateType());
                            mInteractionListener.onMorePositionClicked(position, basicList.getPlateName(), basicList.getPlateType());
                        } else {
                            ToastUtil.makeShortToast("网络异常");
                        }

                    });
                }
            }
            if (viewHolder instanceof TypeFineHolder) {
                //精品
                if (viewHolder.getItemViewType() == TYPE_FINISH) {
                    //奇文精品 完结榜
                    TypeFineHolder holder = (TypeFineHolder) viewHolder;
                    if (basicList.getViewType() == 0) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                    }
                    if (basicList.getPlateName().equals("完结榜")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_finish1);
                    } else if (basicList.getPlateName().equals("奇文精品")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_crazy);
                    }


                    if (basicList.getPlateName().equals("完结榜")) {
                        holder.tvTitle.setText(basicList.getPlateName());
                    } else {
                        holder.tvTitle.setText(basicList.getPlateName());
                    }
                    GridLayoutManager layoutManager = new GridLayoutManager(mContext, 3);
                    holder.recyclerView.setLayoutManager(layoutManager);
                    holder.recyclerView.setHasFixedSize(true);
                    BookStoreAdapter adapter = new BookStoreAdapter(mContext, getItemViewType(position));
                    holder.recyclerView.setAdapter(adapter);
                    adapter.setData(novels);
                    holder.tvSeeMore.setOnClickListener(v -> {
                        mInteractionListener.onMoreClicked(basicList.getPlateName(), basicList.getPlateType());
                    });
                }
                if (viewHolder.getItemViewType() == TYPE_FINE) {
                    //精品推荐 畅销新书
                    TypeFineHolder holder = (TypeFineHolder) viewHolder;
                    holder.tvTitle.setText(basicList.getPlateName());

                    if (basicList.getPlateName().equals("精品推荐")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_recom);
                    } else if (basicList.getPlateName().equals("畅销新书")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_sell_book);
                    }

                    if (basicList.getViewType() == 0) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                    } else {
                        holder.tvSeeMore.setVisibility(View.VISIBLE);
                        if (basicList.getPlateType().equals("55")) {
                            holder.tvSeeMore.setText("查看更多 >");
                        } else {
                            holder.tvSeeMore.setText("查看更多");
                        }
                    }

                    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
                    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                    holder.recyclerView.setLayoutManager(layoutManager);
                    holder.recyclerView.setHasFixedSize(true);
                    BookStoreAdapter adapter;
                    if (basicList.getPlateName().equals("畅销新书")) {
                        adapter = new BookStoreAdapter(mContext, holder.getItemViewType(), 1);
                    } else {
                        adapter = new BookStoreAdapter(mContext, holder.getItemViewType());

                    }
                    holder.recyclerView.setAdapter(adapter);
                    adapter.setData(novels);
                    if (basicList.getPlateName().equals("精品推荐")) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                        holder.tvSeeMore.setText("错过你就蹲在墙角哭吧~");
                        holder.tvSeeMore.setOnClickListener(null);
                    } else {
                        holder.tvSeeMore.setOnClickListener(v -> {
                            mInteractionListener.onMoreClicked(basicList.getPlateName(), basicList.getPlateType());
                        });
                    }
                }
                if (viewHolder.getItemViewType() == TYPE_HOT_SEARCH) {
                    //热搜榜 兴趣选书
                    TypeFineHolder holder = (TypeFineHolder) viewHolder;
                    if (basicList.getViewType() == 0) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                    }
                    if (basicList.getPlateName().equals("热搜榜")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_hotsearch);
                    } else if (basicList.getPlateName().equals("兴趣选书")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_hotsearch);
                    }

                    holder.tvTitle.setText(basicList.getPlateName());
                    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
                    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                    holder.recyclerView.setLayoutManager(layoutManager);
                    holder.recyclerView.setHasFixedSize(true);
                    BookStoreAdapter adapter = new BookStoreAdapter(mContext, holder.getItemViewType());
                    holder.recyclerView.setAdapter(adapter);
                    adapter.setData(novels);
                    holder.tvSeeMore.setOnClickListener(v -> {
                        mInteractionListener.onMoreClicked(basicList.getPlateName(), basicList.getPlateType());
                    });
                }
                //口碑力荐 极品爽文
                if (viewHolder.getItemViewType() == TYPE_HIGH_FORCE_RECOMMEND) {
                    TypeFineHolder holder = (TypeFineHolder) viewHolder;
                    if (basicList.getViewType() == 0) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                    }

                    if (basicList.getPlateName().equals("口碑力荐")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_good_recon);
                    } else if (basicList.getPlateName().equals("极品爽文")) {
                        holder.ivTitleIcon.setImageResource(R.mipmap.icon_best_book);
                    }


                    holder.tvTitle.setText(basicList.getPlateName());
                    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
                    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                    holder.recyclerView.setLayoutManager(layoutManager);
                    holder.recyclerView.setHasFixedSize(true);
                    BookStoreAdapter adapter;
                    if (basicList.getPlateName().equals("极品爽文")) {
                        adapter= new BookStoreAdapter(mContext, holder.getItemViewType(), 9);
                    } else {
                        adapter= new BookStoreAdapter(mContext, holder.getItemViewType());
                    }
                    holder.recyclerView.setAdapter(adapter);
                    adapter.setData(novels);
                    holder.tvSeeMore.setOnClickListener(v -> {
                        mInteractionListener.onMoreClicked(basicList.getPlateName(), basicList.getPlateType());
                    });
                }
                if (viewHolder.getItemViewType() == TYPE_HOT_SERIAL) {
                    //火热连载
                    TypeFineHolder holder = (TypeFineHolder) viewHolder;
                    if (basicList.getViewType() == 0) {
                        holder.tvSeeMore.setVisibility(View.GONE);
                    }
                    holder.ivTitleIcon.setImageResource(R.mipmap.icon_continue);
                    holder.tvTitle.setText(basicList.getPlateName());
                    GridLayoutManager layoutManager = new GridLayoutManager(mContext, 3);
                    holder.recyclerView.setLayoutManager(layoutManager);
                    holder.recyclerView.setHasFixedSize(true);
                    BookStoreHotAdapter adapter = new BookStoreHotAdapter(mContext, holder.getItemViewType());
                    holder.recyclerView.setAdapter(adapter);
                    adapter.setData(novels);
                    holder.tvSeeMore.setOnClickListener(v -> {
                        mInteractionListener.onMoreClicked(basicList.getPlateName(), basicList.getPlateType());
                    });
                }
            }
            //VIP
            if (viewHolder instanceof VIPHolder) {
                if (viewHolder.getItemViewType() == TYPE_VIP_ZONE) {
                    VIPHolder holder = (VIPHolder) viewHolder;
                    holder.viewPager.setClipToPadding(false);
                    holder.viewPager.setPageMargin(12);
                    holder.viewPager.setAdapter(new VIPGalleryAdapter(mContext, novels));
                }
            }
            if (position == getItemCount() - 1) {
                ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) viewHolder.itemView.getLayoutParams();
                layoutParams.bottomMargin = 0;
            }
            if (viewHolder.getItemViewType() == 111) {
                viewHolder.itemView.setVisibility(View.GONE);
            }
        }
    }

    @Override
    public int getItemCount() {
        return mObjects == null ? 0 : mObjects.size();
    }

    public static final int TYPE_BANNER = -2;     //顶部轮播图
    public static final int TYPE_ENTRANCE = -1;   // 分类  排行榜 。。
    public static final int TYPE_EDITOR_RECOMMEND = 0;  // 小编推荐  书友在读 往前经典
    public static final int TYPE_FOR_FREE = 1;  //限时免费
    public static final int TYPE_VIP_ZONE = 2;  //VIP专区
    public static final int TYPE_HOT_SEARCH = 3;  //热搜榜   兴趣选书
    public static final int TYPE_HOT_SERIAL = 4;  //火热连载
    public static final int TYPE_HIGH_FORCE_RECOMMEND = 5;  //口碑力荐 极品爽文
    public static final int TYPE_FINE = 6;  //精品推荐 畅销新书
    public static final int TYPE_FINISH = 7;  //奇文精品 完结榜

    @Override
    public int getItemViewType(int position) {
        Object o = mObjects.get(position);
        if (o instanceof CommonData) {
            return TYPE_BANNER;
        }
        if (position == 1) {
            return TYPE_ENTRANCE;
        }
        if (o instanceof BasicList) {
            BasicList<PlateNovels> basicList = (BasicList<PlateNovels>) o;
            if (basicList.getPlateNovels() == null || basicList.getPlateNovels().size() == 0) {
                return 111;
            }
            int type = basicList.getShowType();
            switch (type) {
                case TYPE_EDITOR_RECOMMEND:
                    return TYPE_EDITOR_RECOMMEND;
                case TYPE_FOR_FREE:
                    return TYPE_FOR_FREE;
                case TYPE_VIP_ZONE:
                    return TYPE_VIP_ZONE;
                case TYPE_HOT_SEARCH:
                    return TYPE_HOT_SEARCH;
                case TYPE_HOT_SERIAL:
                    return TYPE_HOT_SERIAL;
                case TYPE_HIGH_FORCE_RECOMMEND:
                    return TYPE_HIGH_FORCE_RECOMMEND;
                case TYPE_FINE:
                    return TYPE_FINE;
                case TYPE_FINISH:
                    return TYPE_FINISH;
                default:
            }
        }
        return 111;
    }

    public void setData(List<Object> objects) {
        mObjects = objects;
        notifyDataSetChanged();
    }

    public List<Object> getData() {
        if (mObjects != null)
            return mObjects;
        return null;
    }

    class BannerViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.banner)
        Banner mBanner;

        public BannerViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                mBanner.setOutlineProvider(new CustomOutlineProvider());
//                mBanner.setClipToOutline(true);
            }
            mBanner.setImageLoader(new BookStoreMainAdapter.GlideImageLoader(mBanner));
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    class CustomOutlineProvider extends ViewOutlineProvider {
        @Override
        public void getOutline(View view, Outline outline) {
//            Rect rect = new Rect();
//            view.getGlobalVisibleRect(rect);
            Rect selfRect = new Rect(0, 0, view.getRight() - view.getLeft(), view.getBottom() - view.getTop());
            outline.setRoundRect(selfRect, view.getResources().getDimension(R.dimen.qb_px_20));
        }
    }

    class TypeEditorRecommendHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.iv_title_icon)
        ImageView ivTitleIcon;
        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_see_more)
        TextView tvSeeMore;
        @BindView(R.id.recycler_view)
        RecyclerView recyclerView;

        public TypeEditorRecommendHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    class TimeForFreeHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_time)
        TextView tvTime;
        @BindView(R.id.recyclerView)
        RecyclerView recyclerView;

        public TimeForFreeHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    class VIPHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_vip_zone)
        TextView tvVipZone;
        @BindView(R.id.tv_more)
        TextView tvMore;
        @BindView(R.id.view_pager)
        ViewPager viewPager;

        public VIPHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }


    class DefaultHolder extends RecyclerView.ViewHolder {
        public DefaultHolder(@NonNull View itemView) {
            super(itemView);
        }
    }

    class TypeFineHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.iv_title_icon)
        ImageView ivTitleIcon;
        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_see_more)
        TextView tvSeeMore;
        @BindView(R.id.recyclerView)
        RecyclerView recyclerView;

        public TypeFineHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            recyclerView.setFocusable(false);
        }
    }

    static class GlideImageLoader extends ImageLoader {
        Banner mBanner;

        @Override
        public ImageView createImageView(Context context) {
            ImageView imageView = new ImageView(context);
            imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            return imageView;
        }

        GlideImageLoader(Banner banner) {
            this.mBanner = banner;
        }

        @Override
        public void displayImage(Context context, Object path, final ImageView imageView) {
            CarousePicBean carousePics = (CarousePicBean) path;
            Glide.with(context).setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565)).load(carousePics.getIndexPic()).transition(DrawableTransitionOptions.withCrossFade()).into(imageView);
        }
    }

    public interface OnStoreMainAdapterInteractionListener {
        void onMoreClicked(String plateName, String plateType);

        void onMorePositionClicked(int position, String plateName, String plateType);
    }

    class EntranceHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.ll_category)
        LinearLayout llCategory;
        @BindView(R.id.ll_rank_list)
        LinearLayout llRankList;
        @BindView(R.id.ll_monthly)
        LinearLayout ll_monthly;
        @BindView(R.id.ll_FreeOnclick)
        LinearLayout ll_FreeOnclick;
        @BindView(R.id.ll_finish)
        LinearLayout llFinish;

        public EntranceHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
